<template>
  <div class="big">
    <div class="middle">
      <div class="shop">商城登录</div>
      <el-input placeholder="请输入用户名" v-model="username" clearable class="inp inpa">
        <template slot="prefix"><div class="inpab"><i class="el-icon-user-solid"></i></div></template>
      </el-input>
      <el-input placeholder="请输入密码" v-model="password" show-password class="inp inpb">
        <template slot="prefix"><div class="inpbc"><i class="el-icon-unlock"></i></div></template>
      </el-input>
      <div class="re"><el-link href="/register" :underline="false"><div class="reg">注册会员</div></el-link></div>
      <el-button type="warning" round class="but" @click="home">登录</el-button>
    </div>
  </div>

</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      username: "",
      password: "",
    }
  },
  methods: {
    home(){
      this.axios.post('/v1/login',{
        username: this.username,
        password: this.password
      }).then(res => {
        if(res.data.code == 200){
          localStorage.setItem('token', res.data.data.token);
          this.$success(res.data.msg)
          this.$router.push('/home')
          // this.$router.push('/hometwo')
        } else {
          this.$error(res.data.msg)
        }
      })
    }
  }
}
</script>

<style scoped>
.big{
  background-image: url('../../public/c1.jpeg');
  background-position: center;
  height: 100%;
  width: 100%;
  background-size: cover;
  position: fixed;
  left: 0;
  top: 0;
}
.middle{
  width: 17%;
  border: 1px solid rgba(178, 212, 196, 0);
  text-align: center;
  margin: 350px auto;
  padding: 35px 35px 35px 35px;
  border-radius: 5px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  box-shadow: 0 0 25px rgba(178, 212, 196, 0.5);
  background-color:rgba(178,212,196,0.4);
}
.inp{
  width: 90%;
  color: #42b983;
}
.inpb{
  padding-top: 15px;
}
.shop{
  font-size: 40px;
  padding-bottom: 10px;
  font-weight: bold;
  color: orange;
}
.inpab{
  padding-top: 9px;
  padding-left: 7px;
}
.inpbc{
  padding-top: 25px;
  padding-left: 7px;
}
.but{
  width: 90%;
  margin-top: 20px;
  font-weight: bold;
  font-size: 20px;
}
.re{
  margin-top: 20px;
}
.reg{
  color: orange;
  font-weight: bold;
  font-size: 20px;
}



</style>
